number_of_nodes = 30;
maximum_radius = 400;
maximum_radius_to_gaps = 200;

params = ParamsSingleton.instance();

router_type = params.router_type_ROMER;
params.simulation_time_in_msec = 2000;
params.clock_tick_delta_in_msec = 100;
params.number_of_packets_to_deposit_in_single_node_simulation =10;
ticks_to_deposit_packets = [1 2 3 4 5 6 7 8 9 10];
%%%%%%%%%%%%%%%%%%%%%%%%

source_node_id = 6;
dest_node_id = 20;

SingletonInitializer.create_all_singletons();

loss_rates_vector = 0:1:20;
delivery_rates_vector = zeros(1, length(loss_rates_vector));

topology_file_name = ['topology_', num2str(number_of_nodes), '_nodes.mat'];

for i = 1:length(loss_rates_vector)
    params.link_loss_rate_in_precentage = loss_rates_vector(i);
    
    SingletonInitializer.reinit_all_singletons();
    topology = Topology.read_topology_from_file(topology_file_name, router_type);
    
    [current_number_of_paths, delivery_rate] = Simulator.run_single_depositor_in_unloaded_network(topology, source_node_id, dest_node_id, ticks_to_deposit_packets);
    delivery_rates_vector(i) = delivery_rate;
end

figure();
plot(loss_rates_vector, delivery_rates_vector);
xlabel('Loss Rate (%)');
ylabel('Delivery Ratio (%)');
title('ROMER: DeliveryRate = f(LossRate)');

%%%%%%%%%%%%%%%%%%%
router_type = params.router_type_DIJKSTRA;
delivery_rates_vector = zeros(1, length(loss_rates_vector));

for i = 1:length(loss_rates_vector)
    params.link_loss_rate_in_precentage = loss_rates_vector(i);
    
    SingletonInitializer.reinit_all_singletons();
    topology = Topology.read_topology_from_file(topology_file_name, router_type);
    
    [current_number_of_paths, delivery_rate] = Simulator.run_single_depositor_in_unloaded_network(topology, source_node_id, dest_node_id, ticks_to_deposit_packets);
    delivery_rates_vector(i) = delivery_rate;
end
